Versions:

  • 0.22.0
  • 0.16.1

trg is a command-line code search tool from Tokalang that is designed with AI agents as well as human users in mind. It is described as a fast, agent-friendly and symlink-safe code search and hydration tool, placing it in the same category as ripgrep-style search utilities while adding functions aimed at agentic workflows. Search results are presented as centered KWIC snippets, that is, keyword-in-context excerpts in which the matched term sits in the middle of the surrounding text, which helps a reader or a language model judge relevance quickly. In addition to searching, trg supports stateless point hydration, a way of fetching the fuller content around a specific location on demand without keeping session state between calls. The tool also reports edit-ready block boundaries, so that the code block surrounding a match can be identified cleanly before a change is made. Native support for the Model Context Protocol (MCP) allows trg to be connected directly to AI assistants and coding agents as a tool, rather than being wrapped by custom scripts. Its symlink-safe behaviour is intended to prevent problems when a repository contains symbolic links. Typical use cases are searching large code bases from the terminal, supplying a coding agent with compact and relevant context, expanding a search hit into the surrounding code only when needed, and preparing precise edits. The software belongs to the categories of CLI tools, code search and developer tooling for agentic programming. The current release is version 0.22.0, and several versions are available in the catalog.

Tags: